﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace ZZT
{
    public class Tile : Pointer
    {
        public Tile()
            : base(2)
        {
        }

        public Tile(byte[] memory)
            : base(memory, 0)
        {
        }

        public Tile(byte[] memory, int offset)
            : base(memory, offset)
        {
        }

        public Tile Clone()
        {
            Tile result = new Tile();
            CopyTo(result);
            return result;
        }

        public int Color
        {
            get
            {
                return this[1];
            }
            set
            {
                this[1] = (byte)(value & 0xFF);
            }
        }

        public void CopyTo(Tile target)
        {
            target.Value = this.Value;
        }

        public int Id
        {
            get
            {
                return this[0];
            }
            set
            {
                this[0] = (byte)(value & 0xFF);
            }
        }

        public int Value
        {
            get
            {
                return Int16;
            }
            set
            {
                Int16 = (Int16)(value & 0xFFFF);
            }
        }
    }
}
